package com.xiedafeng.www.view;

import com.xiedafeng.www.po.Notice;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.util.List;

public class NoticeView {
    public void showNotice(List<Notice> noticeList){
        GridPane gridPane=new GridPane();
        for (int i = 0; i < noticeList.size(); i++) {
            Notice notice=noticeList.get(i);
            Text circle=new Text("所属瓜圈："+notice.getCircle());
            Text event=new Text("事件内容："+notice.getEventContent());
            Text creator=new Text("举报者："+notice.getSender());
            Text noticeContent=new Text("举报内容："+notice.getNoticeContent());
            Button delete=new Button("删除");
            gridPane.add(circle,0,i*4);
            gridPane.add(creator,2,i*4);
            gridPane.add(event,0,i*4+1,3,1);
            gridPane.add(noticeContent,0,i*4+2,3,1);
            gridPane.add(delete,1,i*4+3);
        }
        gridPane.setAlignment(Pos.CENTER);
        Scene scene=new Scene(gridPane);
        Stage stage=new Stage();
        stage.setScene(scene);
        stage.showAndWait();
    }
}
